Microsoft DirectX 8.1 (C++)

Blocking a Denied Request (Visual Basic)

This topic applies to Windows XP Home Edition and Windows XP Professional only.

In this version of Microsoft TV Technologies, the application is responsible for enforcing conditional access, although service providers can also physically scramble the signal.

When a policy adds a denial to the active request, the CAManager fires a RequestDenialAdded event. If the denial is transient, ignore it. Otherwise, block the user from viewing the request; for example, hide the Video Control or place a bitmap over the video window, and mute the volume. Actually stopping or pausing the Video Control is not recommended, because some policies might require information from the program stream.

The first parameter to the RequestDenialAdded event is a reference to an ICARequest object that contains the request. Use this parameter to obtain the request's CADenials collection. The CADenials.CountDenied property returns the number of non-transient denials in the collection. Block the request if the count is greater than zero.

When a denial changes state from transient to active, or vice versa, the CAManager fires a DenialStateChanged event. When a policy removes a denial, the CAManager fires a RequestDenialRemoved event. In both cases, check the number of non-transient denials that remain.

The following code example loads an image file and uses it to cover the video window when a request is denied.

Dim objDenialPic As IPictureDisp
Private Sub Form_Load()
    ' ...
    Set objDenialPic = LoadPicture("Denied.gif")
    ' ...
End Sub

Private Sub DoCheckRequest(pReq As MSTvCALib.ICARequest)
    Dim cDenied As Long
    cDenied = pReq.Denials.CountDenied
    If cDenied > 0 Then
        mVideoControl.VideoRendererActive.MixerBitmap = objDenialPic 
        mVideoControl.VideoRendererActive.MixerBitmapOpacity = 50
    Else
        mVideoControl.VideoRendererActive.MixerBitmap = Nothing
    End If
End Function

Private Sub mCAManager_RequestDenialAdded( _
    ByVal pReq As MSTvCALib.ICARequest, _
    ByVal pDenial As MSTvCALib.ICADenial, _
    ByVal cDenials As Long _
)
    DoCheckRequest(pReq)
End Sub

Private Sub mCAManager_RequestDenialRemoved( _
   ByVal pReq As MSTvCALib.ICARequest, _
   ByVal pDenial As MSTvCALib.ICADenial, _
   ByVal cDenials As Long _
)
    DoCheckRequest(pReq)
End Sub

For more information about showing an alpha-blended bitmap over the video, see Mixing an Image Onto the Video Window in Visual Basic.